import { lazy } from "react";
import Guard from "./guard";
const Login = lazy(() => import("@/views/login/index.js"))
const Layout  = lazy(() => import("@/layout/index.js"));
const Home = lazy(() => import("@/views/home/index.js"));
const Main = lazy(() => import("@/views/main/index.js"));
const Error = lazy(() => import("@/views/error/index.js"));
const Register = lazy(() => import("@/views/register/index.js"));
const About = lazy(() => import("@/views/about/index.js"));

const routes = [
    {
        path: '/login',
        element: <Login></Login>
    },
    {
        path: '/register',
        element: <Register></Register>
    },
    {
        path: '/',
        element: <Layout></Layout>,
        auth: true,
        children: [
            {
                path: '/home',
                element: <Home></Home>,
                auth: true,
            },
            {
                path: '/about',
                element: <About></About>,
                auth: true,
            },
            {
                path: '/main',
                element: <Main></Main>,
                auth: true,
            }
        ]
    },
    {
        path: '*',
        element: <Error></Error>
    }
];

export { routes, Guard };

